{template 'common/header'}

<div class="main">
	<form action="" method="post" class="form-horizontal form" id="setting-form">
		<div class="panel panel-default">
			<div class="panel-heading">便利店信息</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">名称</label>
					<div class="col-sm-8">
						<input type="text" name="data[name]" class="form-control" value="{$settings['name']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">徽标图案</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_icon('data[icon]', $settings['icon']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">徽标颜色</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_color('data[color]', $settings['color']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">品牌图片</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_image('data[logo]', $settings['logo']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">品牌宣传</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_multi_image('data[pics]', $settings['pics']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">品牌宣传</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_multi_image('data[pics2]', $settings['pics2']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">单音频</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_audio('data[audio]', $settings['audio']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">多音频</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_multi_audio('data[multiaudio]', $settings['multiaudio']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">注册日期</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_date('data[registerdate]', $settings['registerdate'], true);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">营业时间</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_daterange('data[businesshours]', $settings['businesshours'], true);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">地址</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_district('data[address]', empty($settings['address']) ? array() : $settings['address']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">地理位置</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_coordinate('data[map]', $settings['map']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">行业</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_industry('data[industry]', $settings['industry']['parent'], $settings['industry']['child']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">联系人</label>
					<div class="col-sm-8">
						<input type="text" name="data[linkman]" class="form-control" value="{$settings['linkman']}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">联系电话</label>
					<div class="col-sm-8">
						<input type="text" id="phone" name="data[phone]"  class="form-control" value="{$settings['phone']}">
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">所在地址</label>
					<div class="col-sm-8">
						<input type="text" id="address" name="data[detailedaddress]"  class="form-control" value="{$settings['detailedaddress']}">
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">便利店介绍</label>
					<div class="col-sm-8">
						<textarea style="height:200px;" id="description" name="data[description]" class="form-control description" cols="60">{$settings['description']}</textarea>
					</div>
				</div>
				<div class="form-group">
					<div class="col-xs-12 col-sm-9 col-md-10 col-lg-10 col-sm-offset-3 col-md-offset-2 col-lg-offset-2">
						<input name="submit" type="submit" value="提交" class="btn btn-primary" />
						<input type="hidden" name="token" value="{$_W['token']}" />
					</div>
				</div>
			</div>
		</div>
	</form>
</div>

<script>
require(['jquery', 'util'], function($, util){
	$(function(){
		$('#setting-form').submit(function(){
			var result = true;
			if($('input[name="data[name]"]').val() == ''){
				result = false;
				util.message('未填写便利店名称.');
			}
			if($('input[name="data[logo]"]').val() == ''){
				result = false;
				util.message('未填加便利店LOGO.');
			}
			if($('input[name="data[linkman]"]').val() == ''){
				result = false;
				util.message('未填写便利店联系人.');
			}
			if($('input[name="data[phone]"]').val() == ''){
				result = false;
				util.message('未填写便利店联系电话.');
			}
			if($('input[name="data[address]"]').val() == ''){
				result = false;
				util.message('未填写便利店地址.');
			}
			return result;
		});
	});
});
</script>

{template 'common/footer'}